//
#import "BKEnum.h"

@implementation BKEnum

- (id) initWithXMLElement: (NSXMLElement*) elem signatures: (BKSignatures*) sigs
{
	if(self = [super initWithXMLElement: elem signatures: sigs])
	{
		NSXMLNode* theNode = nil;
#if __LP64__
		theNode = [elem attributeForName: @"value64"];
#endif
#if __BIG_ENDIAN__
		if(theNode == nil)
			theNode = [elem attributeForName: @"be_value"];
#endif
#if __LITTLE_ENDIAN__
		if(theNode == nil)
			theNode = [elem attributeForName: @"le_value"];
#endif
		if(theNode == nil)
			theNode = [elem attributeForName: @"value"];
		
		self.value = [NSNumber numberWithDouble: [[theNode stringValue] doubleValue]];
	}
	return self;
}

- (void) dealloc
{
	[_value release];
	[super dealloc];
}

@synthesize value = _value;

- (NSString*) description
{
	return [NSString stringWithFormat: @"<%@: %p, name=%@, value=%@>",
		NSStringFromClass([self class]), self, _name, _value];
}

@end
